/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.inject.Named;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Eric
 */
@Named("tUnits")
@Entity
@Table(name = "t_units")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TUnits.findAll", query = "SELECT t FROM TUnits t"),
    @NamedQuery(name = "TUnits.findById", query = "SELECT t FROM TUnits t WHERE t.id = :id"),
    @NamedQuery(name = "TUnits.findByMake", query = "SELECT t FROM TUnits t WHERE t.make = :make"),
    @NamedQuery(name = "TUnits.findByModel", query = "SELECT t FROM TUnits t WHERE t.model = :model"),
    @NamedQuery(name = "TUnits.findByYear", query = "SELECT t FROM TUnits t WHERE t.year = :year"),
    @NamedQuery(name = "TUnits.findByFuelType", query = "SELECT t FROM TUnits t WHERE t.fuelType = :fuelType"),
    @NamedQuery(name = "TUnits.findByOrigPurchaseDate", query = "SELECT t FROM TUnits t WHERE t.origPurchaseDate = :origPurchaseDate"),
    @NamedQuery(name = "TUnits.findByOwner", query = "SELECT t FROM TUnits t WHERE t.owner = :owner"),
    @NamedQuery(name = "TUnits.findByOperator", query = "SELECT t FROM TUnits t WHERE t.operator = :operator"),
    @NamedQuery(name = "TUnits.findByDecommFlag", query = "SELECT t FROM TUnits t WHERE t.decommFlag = :decommFlag"),
    @NamedQuery(name = "TUnits.findByPoNum", query = "SELECT t FROM TUnits t WHERE t.poNum = :poNum"),
    @NamedQuery(name = "TUnits.findByServiceNum", query = "SELECT t FROM TUnits t WHERE t.serviceNum = :serviceNum"),
    @NamedQuery(name = "TUnits.findByOrigPurchasePrice", query = "SELECT t FROM TUnits t WHERE t.origPurchasePrice = :origPurchasePrice")})
    //@NamedQuery(name = "TUnits.findAllLinkedTires", query = "select * from t_inventory where unit_id = (select id from t_units where id = '2');")})

public class TUnits implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Size(max = 255)
    @Column(name = "make")
    private String make;
    @Size(max = 255)
    @Column(name = "model")
    private String model;
    @Size(max = 255)
    @Column(name = "year")
    private String year;
    @Size(max = 255)
    @Column(name = "fuel_type")
    private String fuelType;
    @Basic(optional = false)
    @NotNull
    @Column(name = "orig_purchase_date")
    @Temporal(TemporalType.DATE)
    private Date origPurchaseDate;
    @Size(max = 255)
    @Column(name = "owner")
    private String owner;
    @Size(max = 255)
    @Column(name = "operator")
    private String operator;
    @Basic(optional = false)
    @NotNull
    @Column(name = "decomm_flag")
    private boolean decommFlag;
    @Size(max = 255)
    @Column(name = "po_num")
    private String poNum;
    @Size(max = 255)
    @Column(name = "service_num")
    private String serviceNum;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "orig_purchase_price")
    private BigDecimal origPurchasePrice;

    public TUnits() {
    }

    public TUnits(Integer id) {
        this.id = id;
    }

    public TUnits(Integer id, Date origPurchaseDate, boolean decommFlag, BigDecimal origPurchasePrice) {
        this.id = id;
        this.origPurchaseDate = origPurchaseDate;
        this.decommFlag = decommFlag;
        this.origPurchasePrice = origPurchasePrice;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getMake() {
        return make;
    }

    public void setMake(String make) {
        this.make = make;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }

    public String getFuelType() {
        return fuelType;
    }

    public void setFuelType(String fuelType) {
        this.fuelType = fuelType;
    }

    public Date getOrigPurchaseDate() {
        return origPurchaseDate;
    }

    public void setOrigPurchaseDate(Date origPurchaseDate) {
        this.origPurchaseDate = origPurchaseDate;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public boolean getDecommFlag() {
        return decommFlag;
    }

    public void setDecommFlag(boolean decommFlag) {
        this.decommFlag = decommFlag;
    }

    public String getPoNum() {
        return poNum;
    }

    public void setPoNum(String poNum) {
        this.poNum = poNum;
    }

    public String getServiceNum() {
        return serviceNum;
    }

    public void setServiceNum(String serviceNum) {
        this.serviceNum = serviceNum;
    }

    public BigDecimal getOrigPurchasePrice() {
        return origPurchasePrice;
    }

    public void setOrigPurchasePrice(BigDecimal origPurchasePrice) {
        this.origPurchasePrice = origPurchasePrice;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TUnits)) {
            return false;
        }
        TUnits other = (TUnits) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.TUnits[ id=" + id + " ]";
    }
    
}
